From e3de0aef64331deb5fdfb22c6e59236687d2857e Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Mon, 4 May 2020 10:14:59 +0200 Subject: Added check if player is in spectator mode (#4709) --- src/ClientHandle.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 43a9bc33e..4c59b47ce 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1641,6 +1641,12 @@ void cClientHandle::HandleSlotSelected(Int16 a_SlotNum) void cClientHandle::HandleSpectate(const cUUID & a_PlayerUUID) { + if (!m_Player->IsGameModeSpectator()) + { + Kick("Tried to use spectator mode when not in game mode spectator."); + return; + } + m_Player->GetWorld()->DoWithPlayerByUUID(a_PlayerUUID, [=](cPlayer & a_ToSpectate) { m_Player->TeleportToEntity(a_ToSpectate); -- cgit v1.2.3